/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.sgs.persist;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author MaUrO FiLhO
 */
@Entity
@Table(name = "item_requsicao")
@NamedQueries({
    @NamedQuery(name = "ItemRequsicao.findAll", query = "SELECT i FROM ItemRequsicao i"),
    @NamedQuery(name = "ItemRequsicao.findByIdItem", query = "SELECT i FROM ItemRequsicao i WHERE i.idItem = :idItem"),
    @NamedQuery(name = "ItemRequsicao.findByStatus", query = "SELECT i FROM ItemRequsicao i WHERE i.status = :status")})
public class ItemRequsicao implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id_item")
    private Integer idItem;
    @Column(name = "status")
    private String status;
    @JoinColumn(name = "id_suprimento", referencedColumnName = "id_suprimento")
    @ManyToOne(optional = false)
    private Suprimento suprimento;
    @JoinColumn(name = "id_requisicao", referencedColumnName = "id_requisicao")
    @ManyToOne(optional = false)
    private Requisicao requisicao;

    public ItemRequsicao() {
    }

    public ItemRequsicao(Integer idItem) {
        this.idItem = idItem;
    }

    public Integer getIdItem() {
        return idItem;
    }

    public void setIdItem(Integer idItem) {
        this.idItem = idItem;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Suprimento getSuprimento() {
        return suprimento;
    }

    public void setSuprimento(Suprimento suprimento) {
        this.suprimento = suprimento;
    }

    public Requisicao getRequisicao() {
        return requisicao;
    }

    public void setRequisicao(Requisicao requisicao) {
        this.requisicao = requisicao;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idItem != null ? idItem.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ItemRequsicao)) {
            return false;
        }
        ItemRequsicao other = (ItemRequsicao) object;
        if ((this.idItem == null && other.idItem != null) || (this.idItem != null && !this.idItem.equals(other.idItem))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.sgs.persist.ItemRequsicao[idItem=" + idItem + "]";
    }

}
